package 抽象.练习;
/*
* 定义SalariedEmployee类继承Employee类
* 实现按月计算工资的员工处理。该类表示，private成员变量monthSalary
* 实现父类的抽象方法earnings(),该方法返回monthlySalary值
* toString()方法输出员工类型信息及员工的name，number，birthday
* */
public class SalariedEmployee extends Employee{
    private double monthSalary;
//调用空参构造器 因为父类中没有声明的构造器，将无参构造器覆盖住了
    public SalariedEmployee(String name, int number, MyDate birthday) {
        super(name, number, birthday);
    }
    public SalariedEmployee(String name, int number, MyDate birthday,double monthSalary) {
        super(name, number, birthday);
        this.monthSalary=monthSalary;
    }

    @Override
    public double earning() {
       return monthSalary;
    }
    @Override
    public String toString(){

        return "SalariedEmployee{"+super.toString()+"}";
    }

}
